package com.nkzy.service.impl;

import com.nkzy.mapper.UserMapper;
import com.nkzy.pojo.User;
import com.nkzy.service.UserService;
import com.nkzy.utils.Md5Util;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User findUserByName(String username) {
        User user = userMapper.selectUserByName(username);
        return user;
    }

    @Override
    public void register(String username, String password) {
        //1.对密码进行加密
        String md5String = Md5Util.getMD5String(password);
        //2.注册
        userMapper.insert02(username,md5String);
    }

}
